<script type="text/javascript">
jQuery(function($){
        var filterNum=1;
	  $(".tianjia").click(function () {  
          filterNum++;  
          var newDiv = document.createElement('div');  
         var str = "<span>包裹"+filterNum+"：快递公司</span> <select  class=\"express\" name=\"express_name[]\"><option value=\"0\">请选择</option><?php foreach ($execute as $exe) :?><option value=\"<?php echo $exe->id ;?>\"><?php echo $exe->express_name ;?></option><?php endforeach;?></select><span style='margin-left:2px;'>单号：        </span><input  type=\"text\" class=\"dtext\" name=\"express_number[]\"><span  style='margin-left:5px;'>备注：</span><input  type=\"text\" class=\"dtext\" name=\"Remark_name[]\" style='margin-left:2px;'><input id='delItem" + filterNum +"' onclick='delItem(" + filterNum + ")' value='删除' class='shanchu' type='button'  style='margin-left:3px;'/>";  
          newDiv.innerHTML = str;  
          newDiv.setAttribute("Id", "kuaidigongshi" + filterNum);  
          $("#dingdan").append(newDiv);  
      });  

	  
});
function delItem(i) {  
    $("#kuaidigongshi" + i).remove();  
}  
/*function tianjia(num) {
    $("#kuaidigongshi" + num + "").show();
}
function shanchu(num) {
    $("#kuaidigongshi" + num + "").hide();
}
*/

function verify()
{
		if(document.frm.express_name.value == "0" && document.frm.express_name.value == "")
		{
				alert("请选择快递公司");
				document.frm.express_name.focus();
				return false;
		}else if(document.frm.express_number.value == "")
		{
				alert("请输入单号！");
				document.frm.express_number.focus();
				return false;
		}else if(document.frm.recipients.value == "")
		{
				alert("请输入收件人！");
				document.frm.recipients.focus();
				return false;
		}
		else if(document.frm.phone.value == "")
		{
				alert("请输入联系方式！");
				document.frm.phone.focus();
				return false;
		}
		return true;
}

</script>
<div class="ArayacakCenter">
<form  name="frm" action="" method="post">
<input type='hidden' name='act' value='sub'>
	<div class="Acch3">新建订单</div>
	<div id="dingdan">
	<div  id="kuaidigongshi1">
		<span>包裹1：快递公司</span>
		<select  class="express" name="express_name[]">
			<option value="0">请选择</option>
			<?php foreach ($execute as $exe) :?>
			<option value="<?php echo $exe->id ;?>"><?php echo $exe->express_name ;?></option>
			<?php endforeach;?>
	    </select>
	    <span>单号：</span>
	    <input  type="text" class="dtext" name="express_number[]">
	    <span>备注：</span>
	    <input  type="text" class="dtext" name="Remark_name[]">
	     <input value="添加"  class="tianjia"  type="button"> 
	</div>
	</div>
	
	
	<div>
		<div class="Acch3 send">发件人信息</div>
		<table border="1">
			<tr>
				<td class="table-user" >姓&nbsp;名&nbsp;：</td>
				<td width="350px"><?php echo $arayacak->field_username_value ; ?></td>
				<td width="40px" align="right">Email：</td>
				<td width="350px"><?php echo $user->mail ; ?></td>
			<tr>
			<tr>
				<td  class="table-address">地&nbsp;址&nbsp;：</td>
				<td width="350px"><?php echo $arayacak->field_address_value ; ?></td>
				<td width="40px" align="right">电&nbsp;话&nbsp;：</td>
				<td width="350px"><?php echo $arayacak->field_tel_value ; ?></td>
			<tr>
			<tr>
				<td  class="table-corp">公&nbsp;司&nbsp;：</td>
				<td width="350px"><?php echo $arayacak->field_corp_value ; ?></td>
				<td width="40px" align="right">邮&nbsp;编&nbsp;：</td>
				<td width="350px"><?php echo $arayacak->field_postcode_value ; ?></td>
			<tr>
		</table>
	</div>
	
	<div>
		<div class="Acch3 send">订单信息</div>
		<table  class="order">
			<tr>
				<td style="width:90px;text-align:right;line-height:20px;"><span>收件人：</span></td>
				<td><INPUT type="text"  name="recipients"></td>
			</tr>
			<tr>
				<td style="width:90px;text-align:right;"><span>联系方式：</span></td>
				<td><INPUT type="text" name="phone"></td>
			</tr>
			<tr>
				<td style="width:90px;text-align:right;"><span>客户订单备注：</span></td>
				<td><textarea maxlength="50" name="Remark" rows="4" cols="37"  class="protext"></textarea></td>
			</tr>
		</table>
	</div>
	
	<div>
		<input type="submit" value="提交订单" class="sub" name="submit"    onclick="return verify()">
		<input type="hidden"  name='act'  value='sub'>
	</div>
</Form>	
</div>


